#ifndef THRESHOLD_H
#define THRESHOLD_H

#include <QImage>
#include <math.h>

class Threshold
{
public:
    enum TMode{OTSU = 0, ENTROPY = 1};

    Threshold();
    Threshold(QImage source, int* grayInfo, int minGray, int maxGray, TMode mode);
    QImage getImage();
    void setThreshold1(int threshold);
    void setThreshold2(int threshold);
    int getThreshold();

private:
    QImage m_image;
    QImage m_source;
    int m_grayInfo[256];
    double m_probability[256];
    int m_totalPixels;
    int m_minGray;
    int m_maxGray;
    int m_threshold1;
    int m_threshold2;
    TMode m_mode;

    void computeThreshold();
    void createImage();
};

#endif // THRESHOLD_H
